<?php
use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\select2\Select2;

/* @var $this yii\web\View */
/* @var $model fztadmin\modules\rbac\models\forms\AdminPower */
/* @var $form \kartik\form\ActiveForm */

$menuReadonly = false;
if (!$model->pid)$menuReadonly = true;
$routeData = [];
foreach ($model::getAllRoutes() as $k => $v) {
    $routeData[$v] = $v;
}
?>

<div class="admin-power-form">

    <?php $form = ActiveForm::begin(['options' => ['style' => ['color' => "#000"]]]); ?>

    <?= $form->field($model, 'pid')->hiddenInput(['maxlength' => true, 'readonly' => true])->label(false) ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'route')->textInput() ?>

    <?= $form->field($model, 'desc')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'status')->dropDownList($model->getStatusDesc()) ?>

    <?= $form->field($model, 'sort')->textInput(['placeholder' => "默认0，从小到大排"]) ?>

    <?= $form->field($model, 'type')->dropDownList($model->getTypeDesc(), ['disabled' => $menuReadonly]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', '新建') : Yii::t('app', '修改'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-warning']) ?>
    </div>

    <?php ActiveForm::end(); ?>
    
</div>
